import java.io.Serializable;

//Stuff, that is common with server code
class MessagesDescription {
	public final static int PLAYERS_NICKNAME = 1;
	public final static int LOGIN_SUCCESSFUL = 2;
	public final static int LOGIN_FAIL = 3;
	public final static int PLAYER_LEFT = 4;
	public final static int OUT_OF_GAME =  5;
	public final static int ADD_PLAYER_FAIL = 6; 
	public final static int ADD_PLAYER_SUCCESS = 7;
	public final static int PLAYER_X_HAS_N_CARDS = 8;
	public final static int CARDS_OPEN = 9;
	public final static int NEW_GAME = 10;
	public final static int ASK_FOR_DECISION = 11;
	public final static int NEXT_PLAYER = 12;
	public final static int WINNER = 13;
	public final static int ENTERING_GAME = 14;
	public final static int PLAYERS_DECISION = 15;

}





class TWebMessage implements Serializable{
	private static final long serialVersionUID = 4514049446113263469L;
	public static final int MAX_ARGS = 10;
	public int purpose;
	public int[] args;
	TWebMessage(){
		args = new int[MAX_ARGS];
	}
}




enum ECardSuit {
	NONE,
	HEART,
	DIAMOND,
	CLUB,
	SPADE
}


class TCard {
	public static final int JACK = 2;
	public static final int QUEEN = 3;
	public static final int KING = 4;
	public static final int ACE = 11;
	
	public ECardSuit suit;
	public int rank;
	
	
	public TCard(int rnk, ECardSuit sui){
		rank = rnk;
		suit = sui;
	}
	public TCard(int digital){
		rank = digital / 10;
		switch (rank % 10){
		case 0: 
			suit = ECardSuit.HEART;
			break;
		case 1: 
			suit = ECardSuit.DIAMOND;
			break;
		case 2: 
			suit = ECardSuit.CLUB;
			break;
		case 3: 
			suit = ECardSuit.SPADE;
			break;
		}
	}
	
	public int Digitize(){
		int res = rank * 10;
		switch (suit){
			case HEART: 
				break;
			case DIAMOND: 
				res += 1;
				break;
			case CLUB: 
				res += 2;
				break;
			case SPADE: 
				res += 3;
				break;
		}
		
		return res;
	}
}

